/* Includes ------------------------------------------------------------------*/
#include "global.h"
#include <stdio.h>
#include <string.h>

/* global variable ---------------------------------------------*/
struct event_queue event_queue = {};

/* private function ---------------------------------------------*/
void loop_start(void);
void loop_end(void);

/*
 * @brief  Main program
 * @param  None
 * @retval None
 */
int main(void)
{
	uint8_t type = 0;
	void *event_payload = 0;

	board_init();
	printf("platform is up\r\n");
	printf("run uart test ...\r\n");

	/* Infinite loop */
	while (1) {
		/* auxiliary things to do before loop*/
		loop_start();

		type = event_fetch(&event_queue, &event_payload);

		if (type == EVENT_NONE) {
			/* count the tick, check if something fails */
		} else if (type == EVENT_IMU_DATA) {
		} else if (type == EVENT_RC_INPUT) {
		} else if (type == EVENT_MAG_DATA) {
		}
		/* auxiliary things to do after loop*/
		loop_end();
	}
}

void loop_start(void)
{
}

void loop_end(void)
{
	static uint64_t start_time = 0;
	uint64_t now = 0;
	size_t sz = sizeof(uint32_t*);

	uint8_t dummy[100] = {'x'};
	char *pstr = "hello this is mark, how are you, how about tomorrow\n";
	now = board_get_systime();
	if (start_time == 0)
		start_time = now;
	if (now - start_time > 2e5) {
		start_time = now;
		board_uart_send(0, pstr, 20);
		printf("\r\nlength is %d\r\n", sz);
	}
}

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
